<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>form表单</title>
		<link rel="stylesheet" href="/adminSite/css/X-ui.css" />
		<link rel="stylesheet" href="/adminSite/css/article-xq.css" />
		<!--[if lt IE 9]>
			<script type="text/javascript" src="/adminSite/js/html5.js"></script>
		<![endif]-->
	</head>
	<body>
		<ol class="breadcrumb-nav">
			<li>
				<a href="">主页</a>
			</li>
			<li>
				说说列表
			</li>
		</ol>
		<div class="pd-20">
			<% if(gossip.length){ %>
				<table class="table table-h table-border table-bg table-bordered mt-20">
					<thead>
						<tr>
							<th style="width:50px">序号</th>
							<th>内容</th>
							<th>发布时间</th>
							<th style="width:150px">操作</th>
						</tr>
					</thead>
					<tbody class="text-c">
						<% gossip.forEach(function(data , index){ %>
							<tr>
								<td><%= index+1 %></td>
								<td><%= data.content %></td>
								<td><%= data.releaseTime %></td>
								<td>
									<a data-id="<%= data.id %>" href="javascript:;" class="delete">删除</a>
								</td>
							</tr>
						<% }) %>
					</tbody>
				</table>
			<% }else{ %>
				<h4>您还未发表过说说</h4>
			<% } %>
		</div>
		<div class="pd-20">
			<a href="/admin/addGossip" class="btn">发表说说</a>
		</div>
		<script type="text/javascript" src="/adminSite/js/jquery-1.11.0.js" ></script>
		<script type="text/javascript" src="/adminSite/js/extend/X-ui-modal/js/X-ui-modal.js" ></script>
		<script>
			$(function(){
				$(".text-c .delete").click(function(){
					var th = $(this);
					XuiModal().confirm("是否确定删除" , function(){
						var data = {id : th.data("id")};
						$.post("/admin/delGossip" , data , function(data){
							if(data.state == "ok"){
								XuiModal().msg("删除成功" , {icon : 4} , function(){
									window.location.reload();
								});
							}else{
								XuiModal().msg(data.message , {icon : 2});
							};
						},"JSON");
					});
				});
			})
		</script>
	</body>
</html>
